#include<iostream>
#include<pthread.h>
#include<cassert>
#include<unistd.h>

using namespace std;

//新线程
void* start_routine(void* args)
{
    while(true)
    {
        cout<<"我是新线程, 我正在运行!"<<endl;
        sleep(1);
    }
} 

int main()
{
    pthread_t tid;
    int n=pthread_create(&tid,nullptr,start_routine,(void*)"thread one");
    assert(n == 0);
    (void)n;

    //主线程
    while(true)
    {
        cout<<"我是主线程, 我正在运行!"<<endl;
        sleep(1);
    }

    return 0;
}

